﻿// Decompiled with JetBrains decompiler
// Type: TaleWorlds.CampaignSystem.TrackedObject
// Assembly: TaleWorlds.CampaignSystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E85F8C15-4DF6-4E9C-A58A-29177E40D07A
// Assembly location: D:\steam\steamapps\common\Mount & Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll

using System.Collections.Generic;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.SaveSystem;

#nullable disable
namespace TaleWorlds.CampaignSystem
{
  public class TrackedObject
  {
    [SaveableField(0)]
    public ITrackableBase Object;
    [SaveableField(1)]
    public int TrackerCount;

    internal static void AutoGeneratedStaticCollectObjectsTrackedObject(
      object o,
      List<object> collectedObjects)
    {
      ((TrackedObject) o).AutoGeneratedInstanceCollectObjects(collectedObjects);
    }

    protected virtual void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
    {
      collectedObjects.Add((object) this.Object);
    }

    internal static object AutoGeneratedGetMemberValueObject(object o)
    {
      return (object) ((TrackedObject) o).Object;
    }

    internal static object AutoGeneratedGetMemberValueTrackerCount(object o)
    {
      return (object) ((TrackedObject) o).TrackerCount;
    }

    public TextObject Name => this.Object.GetName();

    public Vec3 Position => this.Object.GetPosition();

    public float Distance => this.Object.GetTrackDistanceToMainAgent();

    public TrackedObject(ITrackableBase obj)
    {
      this.Object = obj;
      this.TrackerCount = 1;
    }

    public bool Compare(TrackedObject obj) => this.Object == obj.Object;
  }
}
